package com.jiazhong.shixi.diancan_xitong.controller;

import com.jiazhong.shixi.diancan_xitong.bean.Table;
import com.jiazhong.shixi.diancan_xitong.mapper.TableMapper;
import com.jiazhong.shixi.diancan_xitong.util.JsonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/table")
@RestController
public class TableController {

    @Resource
    private TableMapper tableMapper;

    @RequestMapping("/find_tab")
    public JsonResult findByTabNum() {
        List<Table> list = tableMapper.findByTabNum();
        JsonResult result = new JsonResult(true, 200,list, "");
        return result;
    }

    @RequestMapping("/select")
    public JsonResult select(Table tb) {
        tableMapper.select(tb);
        JsonResult result = new JsonResult(true, 200, "success", "");
        return result;
    }

    @RequestMapping("/out")
    public JsonResult out(Table tb) {
        tableMapper.out(tb);
        JsonResult result = new JsonResult(true, 200, "success", "");
        return result;
    }
}
